#include <bits/stdc++.h>
using namespace std;
#define int long long
bool f=0;
int n,m;
vector<char> w;
vector<vector<char>> v;
void dfs(int x,int y)
{
    if(f)return ;
    if(x==n&&y==m)
    {
        if(!f)
        {
            for(int i=0;i<w.size();i++)
            {
                cout<<w[i];
            }
            cout<<endl;
            f=1;
        }
        return ;
    }
    if(x+1<1||x+1>n||v[x+1][y]=='#'){}
    else 
    {
        w.push_back('S');
        dfs(x+1,y);
        w.pop_back();
    }
    if(y+1<1||y+1>m||v[x][y+1]=='#'){}
    else 
    {
        w.push_back('D');
        dfs(x,y+1);
        w.pop_back();
    }
}
void solve()
{
    
    cin>>n>>m;
    v=vector<vector<char>> (n+1,vector<char>(m+1));
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>v[i][j];
        }
    }
    dfs(1,1);
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    //cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}